/**
业主详情页面
 **/
(function (vc) {
    vc.extends({
        data: {
            vipDetailInfo: {
                vipId: '',
                vipName:'',
                vipTel:'',
                sex: '',
                levelName:'',
                birthday: '',
                startTime: '',
                endTime: '',
                createTime: '',
                _currentTab: 'vipDetailUser',
            }
        },
        _initMethod: function () {
            $that.vipDetailInfo.vipId = vc.getParam('vipId');
            if (!vc.notNull($that.vipDetailInfo.vipId)) {
                return;
            }
            $that._listShopVipUsers();

        },
        _initEvent: function () {
            vc.on('vipDetail', 'listCarData', function (_info) {
                //$that._loadFeeDetailInfo();
                $that.changeTab($that.vipDetailInfo._currentTab);
            });
        },
        methods: {
            _listShopVipUsers: function (_page, _rows) {
                
                let param = {
                    params: {
                        vipId:$that.vipDetailInfo.vipId,
                        page:1,
                        row:1,
                        shopId:vc.getCurrentCommunity().shopId
                    }
                };
                //发送get请求
                vc.http.apiGet('/shopVipUser.queryShopVipUser',
                    param,
                    function (json, res) {
                        let _json = JSON.parse(json);
                        vc.copyObject(_json.data[0],$that.vipDetailInfo);
                        $that.changeTab($that.vipDetailInfo._currentTab);
                    }, function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            changeTab: function (_tab) {
                $that.vipDetailInfo._currentTab = _tab;
               
                vc.emit(_tab, 'switch', {
                    vipId: $that.vipDetailInfo.vipId,
                    tel: $that.vipDetailInfo.vipTel,
                });
            },
           
        }
    });
})(window.vc);